
import { LoginProps } from './index.d'

const user = [{
    username: '123',
    password: '123'
}]

export const FetchLogin = ({ username, password }: LoginProps) => {
    console.log('username:', username, password)
    let loginflag = user.some(v => v.username === username && v.password === password)
    if (loginflag) {
        return Promise.resolve({
            code: 0,
            msg: 'success',
            data: {
                token: 123
            }
        })
    } else {
        return Promise.reject({
            code: -1,
            msg: 'fail'
        })
    }
}